#include <stdio.h>
#include <stdlib.h>
#include "image.reader.h"


#if defined(_MSC_VER) || defined(__CYGWIN__) || defined(__MINGW32__) || defined( __BCPLUSPLUS__)  || defined( __MWERKS__)
#  if defined( WIN32 )
#    define EXPORT_DLL  extern "C" __declspec(dllexport)
#  else
#    define EXPORT_DLL  extern "C" __declspec(dllimport)
#  endif
#else
#  define EXPORT_DLL
#endif


extern "C" {

	EXPORT_DLL int* create(const char* fn) {
		return (int*)(ImageReader::create(fn));
	}
	EXPORT_DLL bool close(int* a) {
		return ((ImageReader*)(a))->close();
	}
	EXPORT_DLL bool getType(int* a, CubeType* type){
        return ((ImageReader*)(a))->getType(type);
    }
	EXPORT_DLL bool getSizes(int* a, long long* w, long long* h, long long* d){
        return ((ImageReader*)(a))->getSizes((int64_t*)(w),(int64_t*)(h),(int64_t*)(d));
    }
	EXPORT_DLL char* getSizes2(char* fn){
	fn[1] = 'q';
        return fn;
    }
	EXPORT_DLL bool readData(int* a, char* ptr, long x0, long y0, long z0, long long ystride, long long zstride){
        return ((ImageReader*)(a))->readData(ptr,int32_t(x0),int32_t(y0),int32_t(z0),int64_t(ystride),int64_t(zstride));
    }
}
